package com.tr.rentcar.controller.houtai.back;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tr.rentcar.model.bean.FeedBack;
import com.tr.rentcar.model.dao.FeedbackDao;

/**
 * Servlet implementation class BackController
 */
@WebServlet("/back")
public class BackController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List<FeedBack> lfb;
		FeedbackDao fbd = new FeedbackDao();
		String tel = request.getParameter("tel");
			try {
				if (tel!=null) {
				lfb=fbd.findTentByTel(tel);
				request.setAttribute("lfb", lfb);
			} else if(tel==null||tel==""){
				lfb = fbd.findAll();
				request.setAttribute("lfb", lfb);
				}
			}
				catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			
		} 

		request.getRequestDispatcher("/WEB-INF/jsp/houtai_back.jsp").forward(request, response);

	}

}
